Challenge using dataset from @DiversityinDate to make timelines of notable Black first achievements. Not quite working out the way I wanted it to!
#Notable Black Achievements
library (tidyverse)
library (showtext)
library (patchwork)
library (plotly)
## Loading Google fonts (https://fonts.google.com/)
font_add_google("Montserrat")
font_add_google ("Montserrat Alternates")
showtext_auto ()
df <- read.csv("https://query.data.world/s/conu5g63p5djt76z4v3x2liephcggn", header=TRUE, stringsAsFactors=FALSE)
bycat <- df %>%
group_by (year, category) %>%
mutate(n = n())
timeline <- ggplot (bycat, aes (x=year, y = n, text=accomplishment)) +
geom_col (aes(fill = category))
timeline_themed <- timeline +
theme (text = element_text (family = "Montserrat Alternates", size = 15),
panel.grid = element_blank (),
axis.line.x = element_line (),
axis.text.y = element_blank (),
axis.ticks.x = element_blank (),
axis.ticks.y = element_blank (),
legend.title = element_blank (),
legend.position = "none",
panel.background = element_rect(color = "#FFFFCC", fill = "#FFFFCC"),
plot.background = element_rect(color = "#FFFFCC", fill = "#FFFFCC")) +
scale_fill_manual(values = c("#009999", "#003333", "#669999",
"#336666", "#009999", "#3399CC", "#99CCCC", "#006633")) +
labs (x = " ", y = " ")
timeline_themed
fig1 <- ggplotly (timeline_themed)
fig1 %>% layout (title = "Notable Black 'First' Achievements over Time") %>% layout (margin = list (t = 100, l = 100, b = 100, r = 100))
cumulative <- df %>%
group_by (year) %>%
summarize (n = n()) %>%
mutate (csum = cumsum (n))
wave <- ggplot (cumulative, aes (x=year, y=csum)) + geom_area (fill ="#66CCCC")
wave_themed <- wave + theme (text = element_text (family = "Montserrat Alternates", size = 15),
plot.title = element_text (family = "Montserrat", face = "bold", size = 17),
plot.subtitle = element_text (family = "Montserrat", face = "italic", size = 13),
panel.grid = element_blank (),
panel.background = element_rect(color = "#FFFFCC", fill = "#FFFFCC"),
plot.background = element_rect(color = "#FFFFCC", fill = "#FFFFCC"),
axis.text.y = element_blank (),
axis.ticks.y = element_blank (),
axis.ticks.x = element_line ()) +
labs (title = "Black history is about much more than chronicling \na series of 'firsts'",
subtitle = "The time and place of a breakthrough reflects \nnot only remarkable individual achievement\nbut is itself an indication of the progress \nor lack of progress of black people\nin realizing the centuries-old intertwined goals\nof freedom, equality, and justice. \n~ blackpast.org ",
x = " ",
y = " ")
wave_themed
wave_themed /
timeline_themed